package com.wyz.saas.common.notifice.intent

import android.app.Activity
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import com.wyz.saas.common.notifice.intent.Intenter

class ReopenIntent : Intenter {

    private var intent: Intent?= null
    private val ctx: Context

    constructor(
        ctx: Context,
        activity: Class<out Activity>
    ) {
        this.ctx = ctx
        this.intent = Intent(ctx, activity)
        this.intent?.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
    }

    constructor(
        ctx: Context,
        intent: Intent?
    ) {
        this.ctx = ctx
        this.intent = intent
    }

    override fun toPending(): PendingIntent {
        return PendingIntent.getActivity(ctx, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
    }
}